//
//  WP_TabBarViewController.swift
//  WorkPlan
//
//  Created by 赵凯元 on 2019/6/11.
//  Copyright © 2019 YU. All rights reserved.
//

import UIKit

class WP_TabBarViewController: UITabBarController,UITabBarControllerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        
        
        AddChiController(childVc: WP_MainViewController(), childtitle: "Home", imgname: "uuuu", selectImgname: "uuuu")
        AddChiController(childVc: WP_MainViewController(), childtitle: "Set", imgname: "uuuu", selectImgname: "uuuu")
        
    }
    
    func AddChiController (childVc:UIViewController, childtitle:String,imgname:String,selectImgname:String ) {
        //
        childVc.tabBarItem = UITabBarItem(title: childtitle, image: UIImage(named: imgname)?.withRenderingMode(.alwaysOriginal), selectedImage: UIImage(named: selectImgname)?.withRenderingMode(.alwaysOriginal))
        
        let navgation = UINavigationController(rootViewController: childVc)
        self.addChild(navgation)
        
        childVc.tabBarItem.setTitleTextAttributes([NSAttributedString.Key.foregroundColor:UIColor.black], for: .normal)
        childVc.tabBarItem.setTitleTextAttributes([NSAttributedString.Key.foregroundColor:UIColor.red], for: .selected)
        
        
    }
    

 

}
